import {ITaskCategoryItem} from "@/api/modules/taskCenter";
import {getTaskCategory as _getTaskCategory} from "@/api/taskCenter";

export function useTaskCategory() {
  const categoryList = ref<ITaskCategoryItem[]>([])

  const categorySearchForm = reactive({
    categoryName: ''
  })

  const getTaskCategory = async () => {
    const rs = await _getTaskCategory(categorySearchForm)

    if (rs.code === 200) {
      categoryList.value = rs.payload ?? []
    }
  }

  return {
    categoryList,
    categorySearchForm,
    getTaskCategory
  }
}
